%
( *************************************************************************** )
( * Cut a hole for a D-SUB connector                                        * )
( * Metrical RS274/NGC program                                              * )
( * Copyright 2009 Michael Buesch <mb@bu3sch.de>                            * )
( * Licensed under the GNU/GPL version 3                                    * )
( *************************************************************************** )

#<_cutter_dia> = 6		( Cutter diameter )
#<_speed> = 1000		( min^-1 )
#<_feed> = 100			( mm/min )
#<_zfeed> = 50			( mm/min in Z axis )

#<_depth> = 3			( Cutting depth )
#<_depth_step> = 0.5	( Step for cutting in depth)

( 25 pin D-SUB )
#<_width_top> = 42
#<_width_bot> = 39.5
#<_height> = 12

G17 G40 G49 G80 G90 G94 G61 G21 ( Initial modes )

(G53 G0 X0 Y0 Z0)
G54 S#<_speed> F#<_feed> M3

#<_h> = [[#<_height> / 2] - [#<_cutter_dia> / 2]]
#<_wtop> = [[#<_width_top> / 2] - [#<_cutter_dia> / 2]]
#<_wbot> = [[#<_width_bot> / 2] - [#<_cutter_dia> / 2]]

#<z> = 0
G0 X0 Y#<_h> Z1
G1 Z0
O901 while [#<z> lt #<_depth>]
	#<z> = [#<z> + #<_depth_step>]
	O902 if [#<z> gt #<_depth> ]
		#<z> = #<_depth>
	O902 endif
	G1 Z[#<z> * -1] F#<_zfeed>

	G1 X#<_wtop> F#<_feed>
	G1 X#<_wbot> Y[-1 * #<_h>]
	G1 X[-1 * #<_wbot>]
	G1 X[-1 * #<_wtop>] Y#<_h>
	G1 X0
O901 endwhile
G1 X1
G0 Z30
G53 G0 X0 Y0 M5

M30

%
vim: syntax=rs274ngc ts=4
